<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>西安道路门牌系统</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>

    <!--css-->
    <link rel="stylesheet" href="/css/ydui.css"/>
    <link rel="stylesheet" href="/css/demo.css"/>
    <link rel="stylesheet" href="/css/style.css"/>
</head>
<body>
<section class="g-flexview">
    <header class="m-navbar">
        <div class="navbar-item">
            <i class="icon-qrscan" style="font-size: 24px;" onclick="chufashangchuan()">
            </i>
        </div>
        <input type="file" style="display:none" id="fileCamera" accept="image/*" capture="camera">
        <div class="navbar-center"><span class="navbar-title">西安道路门牌管理</span></div>
        <a href="/userIndex" class="navbar-item"><i class="icon-ucenter-outline" style="font-size: 26px;"></i></a>
    </header>
    <div class="g-scrollview">
        <div class="bannerbox"
             style="position: relative;height: 200px;background: url('/images/indexbanner.png') no-repeat top center;background-size: cover;">

        </div>
        <div class="m-grids-2 iconbox"><a class="grids-item" href="/anzhuang">
            <div class="grids-icon"><i class="demo-icons-button"></i></div>
            <div class="grids-txt">门牌安装</div>
        </a> <a class="grids-item" href="/xunjian">
            <div class="grids-icon"><i class="demo-icons-dialog"></i></div>
            <div class="grids-txt">门牌巡检</div>
        </a> <a class="grids-item" href="/weihu">
            <div class="grids-icon"><i class="demo-icons-cell"></i></div>
            <div class="grids-txt">更新维护</div>
        </a> <a class="grids-item" href="#">
            <div class="grids-icon"><i class="demo-icons-list"></i></div>
            <div class="grids-txt">系统管理</div>
        </a>
        </div>
    </div>
    <footer class="footer">©2018西安道路门牌系统</footer>
</section>

<!--js-->
<script src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/llqrcode.js"></script>
<script src="/js/ydui.js"></script>
<script src="/js/ydui.flexible.js"></script>
<script type="text/javascript">

    function chufashangchuan() {
        $("#fileCamera").click();
    }


    // 获取图片url
    var getObjectURL = function (file) {
        var url = null;
        if (window.createObjectURL != undefined) { // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    };

    $("#fileCamera").on("change", function () {

        // console.log(this.files[0]);// newfile[0]是通过input file上传的二维码图片文件
        qrcode.decode(getObjectURL(this.files[0]));
        qrcode.callback = function(imgMsg){
            console.log(imgMsg);
            if (imgMsg=='error decoding QR Code'){
                alert("二维码不合法，请重新扫描");
            }else {
                window.location.href="/saoma/"+imgMsg;
                // alert(imgMsg);
            }
        }
    });
</script>


</body>
</html>
